package fr.esiag.projet17.persistence.dao.oracle;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import fr.esiag.projet17.persistence.dao.ADAOFactory;
import fr.esiag.projet17.persistence.dao.oracle.impl.UtilisateurDAO;

public class DAOFactory extends ADAOFactory {

	protected static Properties props;

	static {
		props = new Properties();
		InputStream input;
		try {
			input = DAOFactory.class.getResourceAsStream("oracle_orders.properties");
			props.load(input);
			// TODO : Passer par un Datasource
			/*
			 * String driverName = props.getProperty("driver"); Class<Driver>
			 * driverClass = (Class<Driver>) Class.forName(driverName); Driver
			 * driver = driverClass.newInstance(); String url =
			 * props.getProperty("url"); String login =
			 * props.getProperty("login"); String password =
			 * props.getProperty("password"); conn =
			 * DriverManager.getConnection(url, login, password);
			 */
		} catch (FileNotFoundException e) {
			// TODO : log
			e.printStackTrace();
		} catch (IOException e) {
			// TODO: log
			e.printStackTrace();
		}
		/*
		 * catch (ClassNotFoundException e) { // TODO Auto-generated catch block
		 * e.printStackTrace(); } catch (InstantiationException e) { // TODO
		 * Auto-generated catch block e.printStackTrace(); } catch
		 * (IllegalAccessException e) { // TODO Auto-generated catch block
		 * e.printStackTrace(); } catch (SQLException e) { // TODO
		 * Auto-generated catch block e.printStackTrace(); }
		 */
	}
	
	public DAOFactory() {
		// TODO Auto-generated constructor stub
	}

	@Override
	public UtilisateurDAO getUtilisateurDAO() {
		return new UtilisateurDAO();
	}

	public static Properties getProps() {
		return props;
	}
}
